<?php
namespace app\model\crm;

use think\Model;

class Review extends Model
{
    // 设置表名
    protected $name = 'crm_review';
    
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';
    
    // 定义字段类型
    protected $type = [
        'review_type' => 'integer',
        'status' => 'integer',
        'review_time' => 'datetime'
    ];
    
    // 获取审核类型标签
    public function getReviewTypeTextAttr($value, $data)
    {
        $types = [
            1 => '业务订单审核',
            2 => '联系人修改审核',
            3 => '联系人删除审核'
        ];
        return $types[$data['review_type']] ?? '未知';
    }
    
    // 获取审核状态标签
    public function getStatusTextAttr($value, $data)
    {
        $status = [
            1 => '待审核',
            2 => '审核通过',
            3 => '审核驳回'
        ];
        return $status[$data['status']] ?? '未知';
    }
}